package github.sf.fw.tools.db;


import github.sf.fw.tools.db.model.ResultData;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;

public class ResultSetWrapper extends ArrayList<ResultData> {
    private Statement statement;
    private ResultSet resultSet;

    public ResultSetWrapper(int initialCapacity) {
        super(initialCapacity);
    }

    public ResultSetWrapper() {
        super();
    }

    public ResultSetWrapper(Collection<? extends ResultData> c) {
        super(c);
    }

    public ResultSetWrapper(ResultSet resultSet, int initialCapacity) {
        super(initialCapacity);
        this.resultSet = resultSet;
    }

    public ResultSet getResultSet() {
        return resultSet;
    }

    public void setStatement(Statement statement) {
        this.statement = statement;
    }

    public void close() {
        if (statement != null) {
            try {
                statement.close();
            } catch (SQLException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
